<template>
  <div class="topthree">
    <NuxtImg class="bg" src="/images/ranking/topthree.png" />
    <div class="text">
      <div
        class="item"
        :class="item.class"
        v-for="item in topThreeList"
        :key="item.id"
      >
        <p>{{ item.userId }}</p>
        <p>
          <NuxtImg src="/images/ranking/icon-money.png" />
          {{ item.money }}
        </p>
        <p>
          <span>{{ item.moneyTotal }}</span
          >({{ item.moneyTip }})
        </p>
      </div>
    </div>
    <!-- 悬浮图标 -->
    <div class="abs1" v-click-move @click="toRules">
      <NuxtImg src="/images/layout/icon-rules.png" />
    </div>
    <div class="abs2" v-click-move @click="toReword">{{ lang.presente }}</div>
  </div>
  <p class="text2">{{ lang.top_three_tip_1 }}</p>
  <p class="text2" v-if="activeParentTab === 1">
    {{ lang.top_three_tip_2_1 }}
    {{ paraNum }}
    {{ lang.top_three_tip_2_2 }}
  </p>
</template>

<script setup lang="ts">
const lang: any = getCurrentPageLang("ranking");

defineProps(["activeParentTab", "activeChildTab"]);

function toRules() {
  navigateTo({ name: "ranking-rules" });
}

function toReword() {
  navigateTo({ name: "ranking-reword" });
}

const topThreeList = ref<any[]>([]);

const paraNum = ref(5);
topThreeList.value = [
  {
    id: 1,
    userId: "556****400",
    money: "61.598,80",
    moneyTotal: "15.618,42",
    moneyTip: "6.00%",
    class: "item2",
  },
  {
    id: 2,
    userId: "551****037",
    money: "62.657,30",
    moneyTotal: "26.030,70",
    moneyTip: "10.00%",
    class: "item1",
  },
  {
    id: 3,
    userId: "559****352",
    money: "60.751,20",
    moneyTotal: "10.412,28",
    moneyTip: "4.00%",
    class: "item3",
  },
];
</script>

<style scoped lang="scss">
.topthree {
  margin-top: 0.3rem;
  text-align: center;
  position: relative;
}
.topthree .bg {
  height: 5.45rem;
}
.topthree .text {
  width: 100%;
  padding: 0 0.25rem;
  position: absolute;
  margin-top: -2.05rem;
  font-size: 0.32rem;
}
.topthree .text .item {
  min-width: 2.3rem;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0.1rem;
  justify-content: center;
  position: relative;
  position: absolute;
}
.topthree .text .item1 {
  left: 3.8rem;
  top: -0.32rem;
  p:first-child {
    color: #fefe63;
  }
}
.topthree .text .item2 {
  left: 0.88rem;
  top: -0.06rem;
  p:first-child {
    color: #dfdffe;
  }
}
.topthree .text .item3 {
  right: 0.88rem;
  top: -0.06rem;
  p:first-child {
    color: #ffc5c6;
  }
}
.topthree .text .item p {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.15rem;
}
.topthree .text .item p:nth-of-type(3) {
  font-size: 0.28rem;
}
.topthree .text .item p {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.1rem;
}
.topthree .text img {
  width: 0.32rem;
  height: 0.36rem;
  margin-right: 0.07rem;
}
.topthree .text .item span {
  color: var(--theme-dec4);
}
.text2 {
  font-weight: 400;
  font-size: 0.32rem;
  text-align: center;
  position: relative;
  margin-top: 0.1rem;
  color: #a168d7;
}
.abs1 {
  background: var(--theme-neutral5);
  width: 0.9rem;
  height: 0.7rem;
  border-radius: 0.35rem 0rem 0rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 0;
  top: -4.6rem;
}
.abs1 img {
  width: 0.8rem;
  height: 0.84rem;
}
.abs2 {
  width: 2.01rem;
  height: 0.9rem;
  background: linear-gradient(180deg, #ff3f9e 0%, #ff3f9e 100%);
  box-shadow: 0 0 #00000080, 0 0 #00000026;
  border-radius: 2rem 0 0 2rem;
  font-weight: 700;
  font-size: 0.32rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: -0.2rem;
  top: -0.4rem;
}
</style>
